<template>
  <div class="overlayPromotion">
    <div class="filterEvent">
      <el-row :gutter="20">
        <el-form ref="formData" :model="formData" label-width="180px">
          <el-col :span="6">
            <el-form-item label="ID">
              <el-input v-model="formData.overlayId" clearable></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="活动名称">
              <el-input v-model="formData.overlayName" clearable></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="状态">
              <el-select v-model="formData.status" placeholder="请选择">
                <el-option
                  v-for="(item,index) in formData.options"
                  :key="index"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-button>查询</el-button>
            <el-button>添加</el-button>
          </el-col>
        </el-form>
      </el-row>
    </div>
    <el-table :data="tableData" border style="width: 100%">
      <el-table-column label="ID" prop="overlayId"></el-table-column>
      <el-table-column label="叠加名称" prop="overlayName"></el-table-column>
      <el-table-column label="状态" prop="status"></el-table-column>
      <el-table-column label="创建人" prop="operator"></el-table-column>
      <el-table-column label="创建时间" prop="time"></el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button size="small" type="text" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
          <el-button size="small" type="text" @click="handleClose(scope.$index, scope.row)">关闭</el-button>
          <el-button size="small" type="text" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-dialog title="提示" :visible.sync="dialogVisible" width="30%">
      <span>这是一段信息</span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
export default {
  components: {},
  data() {
    return {
      formData: {
        //查询条件
        status: "",
        options: [
          {
            label: "全部",
            value: 0
          },
          {
            label: "已开启",
            value: 1
          },
          {
            label: "已关闭",
            value: 2
          }
        ]
      },
      //数据列表
      tableData: [
        {
          overlayId: 1000,
          overlayName: "优惠券",
          status: "开启",
          operator: "李想",
          time: "2020-02-04 11:00"
        }
      ],
      //编辑弹框
      dialogVisible: false
    };
  },
  methods: {
    // 显示编辑页面
    handleEdit: function(params) {
      this.dialogVisible = true;
    },
    handleClose() {},
    // 删除
    handleDelete: function(data) {
      this.$confirm("确认删除吗？", "提示", {}).then(() => {
        var params = {
          ids: data.row.id
        };
        var that = this;
        this.utils.request.deleteEntryTerms(params, function(res) {
          if (res.code == "0000") {
            that.$message({ message: "操作成功", type: "success" });
          } else {
            that.$message({
              message: "操作失败, " + res.msg,
              type: "error"
            });
          }
        });
      });
    }
  },
  mounted() {}
};
</script>
<style scoped lang="scss">
  @import '../../../assets/css/public.scss';
.overlayPromotion {
  margin: 30px 0;
  .filterEvent {
    margin-bottom: 30px;
  }
}
</style>;
